<?php

require_once(APP.'libs'.DS.'util.php');
require_once(APP.'libs'.DS.'system_properties.php');
App::import('Vendor','/infolex/rest_wrapper');
class CountController extends AppController
{
	var $helpers = array('javascript','ToolTip');
	var $layout='';
	var $uses=array('Count');
	

	function search_product() {
	    uses('sanitize');
	    $q = empty($_REQUEST['q'])?'':trim($_REQUEST['q']);
	    $sanitize=new Sanitize();
	    $q = $sanitize->escape(strip_tags($q));
	    
        $this->set("q",$q);

        //$GLOBALS
        $this->Count->connect();
        
	    if (empty($q)){
	        $this->render(null,'management_layout','/count/search_product');
	        return ;
	    }
	    
	    //get pids
	    $data = $this->Count->searchAndCount($q);
	    
	    $this->set("data",$data);        
	    
        $this->render(null,'management_layout','/count/search_product');
	}
	
}
